package org.darkforest.common.services.impl;

import org.darkforest.common.services.FestivalService;
import org.darkforest.dao.mapper.FestivalMapper;
import org.darkforest.dao.mapper.TagFestivalRelationMapper;
import org.darkforest.model.TagFestivalRelation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by pc on 2017/4/8.
 */
@Service
public class FestivalServiceImpl implements FestivalService {
    @Autowired
    private FestivalMapper festivalMapper;
    @Autowired
    private TagFestivalRelationMapper tagFestivalRelationMapper;
    @Override
    @Transactional
    public int deleteFandFR(Integer id) {
        int i = festivalMapper.deleteByPrimaryKey(id);
        if (i > 0) {
            TagFestivalRelation tagFestivalRelation = new TagFestivalRelation();
            tagFestivalRelation.setfId(id);
            tagFestivalRelationMapper.deleteByCondition(tagFestivalRelation);
        }
        return i;
    }
}
